<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" id="t1">
<input type="button" value="美女" onclick="f1(1)">
<input type="button" value="帅哥" onclick="f1(2)">

<script>
    let t = document.querySelector("#t1");
    function f1(x){
         let imgName = x==1?"../b.jpg":"../bigairplane.png"
        for (let i = 0; i < t.value; i++) {
            let img = document.createElement("img");
             img.src = imgName;
             document.body.append(img)
        }
       /* switch (x){
            case 1:
                for (let i = 0; i < a; i++) {
                    let img = document.createElement("img");
                    img.src = "../b.jpg";
                    document.body.append(img) ;

                }
                break;
            case 2:
                for (let i = 0; i < a; i++) {
                    let img = document.createElement("img");
                    img.src="../bigairplane.png";
                    document.body.append(img);
                }
                break
        }*/

    }
</script>
</body>
</html>